<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="wzc">
        <h2>显示格式化日期时间</h2>
        <p>当前时间一:{{date}}</p>
        <p>当前时间二:{{date | date}}</p>
        <p>当前时间三:{{date | date('HH:mm:ss')}}</p>
    </div>
    <script src="./vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/moment.js/2.29.1/moment.js"></script>
    <script>
        Vue.filter('date', function(value, format = 'YYYY-MM-DD HH:mm:ss') {
            return moment(value).format(format)
        });
        new Vue({
            el: "#wzc",
            data: {
                date: new Date(),
            }
        })
    </script>
</body>

</html>